﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.WindowsAzure.ServiceRuntime;

namespace BasicClasses
{
    public class ProntuarioDataSource
    {
        private static ProntuarioContext context = new ProntuarioContext();
        private static string tableName = RoleEnvironment.GetConfigurationSettingValue("ProntuarioTable");

        public static IEnumerable<Prontuario> SelectAll()
        {
            return context.Prontuarios;
        }

        public static void Add(Prontuario prontuario, string partitionKey) //partitionKey == Pais
        {
            prontuario.PartitionKey = partitionKey;
            prontuario.RowKey = Guid.NewGuid().ToString();
            context.AddObject(tableName, prontuario);
            context.SaveChanges();
        }
    }
}
